package com.fdq.dianping.util;

import cn.hutool.json.JSONUtil;
import com.fdq.dianping.entity.ResultMessage;

/**
 * 用于封装服务器发送给用户的信息
 */

public class MessageUtils {

    public static String genMessage(boolean isSystemMessage,Integer fromUser, Object message) {

        ResultMessage result = new ResultMessage();
        result.setSystem(isSystemMessage);
        result.setMessage(message);
        if(fromUser != null) {
            result.setFromUser(fromUser);
        }
        return JSONUtil.toJsonStr(result);
    }
}